package com.longge.wechat.entity;

import java.util.Date;

public class Boss {
	private static Boss boss = null;
	
	private static String name; //boss名字
	private static int blood; //初始血量
	private static Date createTime; //创建时间
	private static int isDead; //是否死亡（0：否     1：是）
	private static String userMark; //用户打boss备注
	private static String deadMark ;//= "boss已死亡，下次打boss活动即将展开，欢迎你的加入"; //boss死亡后的备注
	private static String lastUser; //最后打死boss用户（手机号）
	private static String detail;// = "次boss是女娲娘娘五彩石补天时由神石吸取日月精华而生" ; //用户打boss备注
	
	private Boss(String name,int blood,String deadMark,String detail) {
		this.name = name;
		this.blood = blood;
		this.createTime = new Date();
		this.isDead = 0;
		this.deadMark = deadMark;
		this.detail = detail;
	}
	
	public static void getBoss(String name,int blood,String deadMark,String detail) {
		if (boss == null) {
			boss = new Boss(name, blood, deadMark, detail);
		}
	}
	
	
	public static Boss getInstance() {
		return boss;
	}
	
	public synchronized void fightBoss(String user) {
		boss.blood -= 1;
		
		System.out.println("血量剩余："+boss.blood);
		if(boss.blood <= 0) {
			boss.setLastUser(user);
			boss.setIsDead(1);
			
		}
		if(boss.userMark == null) {
			boss.setUserMark(user+"->"+boss.blood+";");
		}else {
			boss.setUserMark(boss.userMark+";"+user+"->"+boss.blood);
		}
	}
	
	
	
	public static String getName() {
		return name;
	}
	public static void setName(String name) {
		Boss.name = name;
	}
	public static int getBlood() {
		return blood;
	}
	public static void setBlood(int blood) {
		Boss.blood = blood;
	}
	public static Date getCreateTime() {
		return createTime;
	}
	public static void setCreateTime(Date createTime) {
		Boss.createTime = createTime;
	}
	public static int getIsDead() {
		return isDead;
	}
	public static void setIsDead(int isDead) {
		Boss.isDead = isDead;
	}
	public static String getUserMark() {
		return userMark;
	}
	public static void setUserMark(String userMark) {
		Boss.userMark = userMark;
	}
	public static String getDeadMark() {
		return deadMark;
	}
	public static void setDeadMark(String deadMark) {
		Boss.deadMark = deadMark;
	}
	public static String getLastUser() {
		return lastUser;
	}
	public static void setLastUser(String lastUser) {
		Boss.lastUser = lastUser;
	}
	public static String getDetail() {
		return detail;
	}
	public static void setDetail(String detail) {
		Boss.detail = detail;
	}
	
	
}
